<?php
## include required files
/*******************************/
require_once '../../includefiles.php';
require_once '../../model/message.php';
require_once '../../model/users.php';
require_once '../../redirect.php';

checkUserLogin();

## Create Objects
/*******************************/
$msgObj = new Model_Message();
$userObj = new Model_Users();
/*******************************/

$userId = $_SESSION['getbids_id'];
$userDetArray = $userObj->getUserDetailsByUserId($userId);
$smarty->assign('userDetArray',$userDetArray);


$msgId = base64_decode($_GET['id1']);
$page = $_GET['id2'];
$smarty->assign("page", $page);

$msgArray = $msgObj->getMessageDetailsById($msgId);
$msgArray["ago"] = ago($msgArray['send_date']);
$smarty->assign("msgArray", $msgArray);
if($_GET['id3']=='inbox')
	$receiverDetArr = $userObj->getUserDetailsByUserId($msgArray['from_id']);
else	
	$receiverDetArr = $userObj->getUserDetailsByUserId($msgArray['to_id']);
$smarty->assign("receiverDetArr", $receiverDetArr);


$active = "myaccount";
$smarty->assign("active", $active);
if($_GET['id3']=='inbox')
	$subactive = "mymessages";
else	
	$subactive = "mysentmessages";
$smarty->assign("subactive", $subactive);

$mainmenu='2';
$smarty->assign("mainmenu",$mainmenu);

$smarty->display(TEMPLATEDIR . '/modules/myaccount/message_view.tpl');
?>